;;; packages - package definitions for GNU Guix
;;; Copyright (C) 2017 ng0
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU Affero General Public License as
;;; published by the Free Software Foundation, either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU Affero General Public License for more details.
;;;
;;; You should have received a copy of the GNU Affero General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

(define-module (ng0 packages twoefthirty)
  #:use-module (guix build-system gnu)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (gnu packages)
  #:use-module (gnu packages assembly)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages mpd)
  #:use-module (gnu packages cups)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages image)
  #:use-module (gnu packages gawk)
  #:use-module (gnu packages base)
  #:use-module (gnu packages libbsd)
  #:use-module (gnu packages python)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages check)
  #:use-module (gnu packages autotools))

;; Packages of software hosted on 2f30.org
(define* (2f30-uri name version #:optional (extension ".tar.gz"))
  "Return a URI string for the package hosted on 2f30.org
corresponding to NAME and VERSION.  EXTENSION is the file name
extension, such as '.tar.gz'."
  (string-append "http://dl.2f30.org/releases/"
                 name "-" version extension))

(define-public smu
  (package
    (name "smu")
    (version "1.4")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://github.com/Gottox/smu/archive/v"
                           version ".tar.gz"))
       (file-name (string-append name "-" version ".tar.gz"))
       (sha256
        (base32
         "0iazl45rkz8ngsb5hpykl76w0ngvdvqqhym1qz5wykgmrzk293rp"))))
    (build-system gnu-build-system)
    (arguments
     `(#:make-flags (list "CC=gcc" (string-append "PREFIX="
                                                  (assoc-ref %outputs "out")))
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (delete 'configure))))
    (home-page "https://github.com/Gottox/smu")
    (synopsis "simple markup")
    (description "Smu (simple markup) is a simple markdown like syntax.")
    (license license:x11)))

(define-public e3
  (package
    (name "e3")
    (version "2.82")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "https://sites.google.com/site/e3editor/Home/"
                           "e3-" version ".tgz"))
       (sha256
        (base32
         "0919kadkas020maqq37852isnzp053q2fnws2zh3mz81d1jiviak"))))
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f
       #:make-flags (list (string-append "PREFIX="
                                         (assoc-ref %outputs "out")))
       #:phases
       (modify-phases %standard-phases
         (delete 'configure))))
    (inputs
     `(("nasm" ,nasm)))
    (home-page "https://sites.google.com/site/e3editor/")
    (synopsis "Very tiny editor in ASM")
    (description
     "Very tiny editor in ASM with emacs, pico, wordstar, and vi keybindings")
    (license license:gpl2+)))

(define-public uemacs
  (let ((commit "8841922689769960fa074fbb053cb8507f2f3ed9")
        (revision "1"))
    (package
      (name "uemacs")
      (version (string-append "4.0.15-" revision "." (string-take commit 7)))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://git.kernel.org/pub/scm/editors/uemacs/uemacs.git")
               (commit commit)))
         (file-name (string-append name "-" version "-checkout"))
         (sha256
          (base32
           "14yq7kpkax111cg6k7i3mnqk7sq7a65krq6qizzj7vvnm7bsj3sd"))))
      (build-system gnu-build-system)
      (arguments
       `(#:tests? #f
         #:make-flags (list (string-append "BINDIR="
                                           (assoc-ref %outputs "out")
                                           "/bin")
                            (string-append "LIBDIR="
                                           (assoc-ref %outputs "out")
                                           "/lib"))
         #:phases
         (modify-phases %standard-phases
           (delete 'configure)
           (add-before 'build 'curses
             (lambda _
               (substitute* "Makefile"
                 (("lcurses") "lncurses"))))
           (add-before 'install 'make-dir
             (lambda* (#:key outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))
                      (bin (string-append out "/bin"))
                      (lib (string-append out "/lib")))
                 (mkdir-p bin)
                 (mkdir-p lib)
                 #t))))))
      (inputs
       `(("ncurses" ,ncurses)))
      (home-page "https://git.kernel.org/pub/scm/editors/uemacs/uemacs.git")
      (synopsis "Full screen editor bsed on MicroEMACS 3.9e")
      (description
       "Editor. FIXME description. Small size.")
      ;; Original statement of copying policy:
      ;; MicroEMACS 3.9 can be copied and distributed freely for any
      ;; non-commercial purposes. MicroEMACS 3.9 can only be incorporated
      ;; into commercial software with the permission of the current author
      ;; [Daniel M. Lawrence].
      ;; NOTE: Current maintainer is Linus Torvald.
      (license #f))))
